import pandas as pd
import json

# 读取CSV文件
data = pd.read_csv('results.csv')

# 获取所有列名
columns = data.columns.tolist()

# 移除epoch列
columns.remove('epoch')

# 创建结果字典
result = {}

# 遍历每一列并与epoch列配对
for col in columns:
    result[col] = dict(zip(data['epoch'], data[col]))

# 输出JSON结果
with open('output.json', 'w') as f:
    json.dump(result, f, indent=4)

print("JSON文件已生成: output.json")